/**
 * Reducer数据处理
 * @type {{menuName: string}}
 */
import {type} from '../action/index'

const initialState = {//默认值
    menuName: '首页',
    name: '',
    breadcrumb: {
        name: '',
        url:'/admin/home'
    },
    navLeft: '',
    windowHeight:0
};
export default (state = initialState, action) => {
    switch (action.type) {
        case type.SWITCH_MENU:
            return {
                ...state,
                menuName: action.menuName
            };
            break;
        case type.SET_TOKEN:
            return {
                ...state,
                token: action.token
            };
            break;
        case type.SET_BD:
            return {
                ...state,
                breadcrumb:action.breadcrumb
            };
            break;
        case type.SET_NAVLEFT:
            return {
                ...state,
                navLeft: action.navLeft,
            };
            break;

        case type.WINDOW_HEIGHT:
            return {
                ...state,
                windowHeight:action.windowHeight
            };
        default:
            return {
                ...state,
            };
            break;
    }
}